package com.hp.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Md5Encryption {
    /**
     * 返回MD5加密后的哈希值
     * @param Password	传入的密码
     * @return	返回的哈希值
     * @throws NoSuchAlgorithmException
     */
    public static String Md5Encryption(String Password) throws NoSuchAlgorithmException {
        MessageDigest digest=MessageDigest.getInstance("MD5");
        digest.update(Password.getBytes());
        return new BigInteger(1,digest.digest()).toString(16);
    }


    public static void main(String[] args) throws Exception {
        String mima=Md5Encryption("aaa");
        System.out.println(mima);
    }
}
